package com.books.utils;


import com.mysql.cj.jdbc.MysqlDataSource;
import org.apache.commons.dbutils.QueryRunner;

/**
 * @author smz ljy cz
 * @date 2023年12月9日
 * 数据库的工具类
 */

public class MyDbutils {
    private static MysqlDataSource dataSource;

    static {
        dataSource = new MysqlDataSource();
        dataSource.setUser("root");
        dataSource.setPassword("6666");
        dataSource.setUrl("jdbc:mysql://localhost:3306/books?serverTimezone=UTC&useUnicode=true&characterEncoding=utf8");
    }

    public static QueryRunner getQueryRunner() {
        return new QueryRunner(dataSource);

    }
}
